#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    using ll = long long int;

    int n;
    std::cin >> n;
    std::vector<ll> a(n);

    for (auto & val : a) {
        std::cin >> val;
    }

    auto tallest = *std::max_element(a.begin(), a.end());
    auto shortest = *std::min_element(a.begin(), a.end());

    for (auto val : a) {
        std::cout << (tallest - val) << " ";
    }
    std::cout << "\n";

    for (auto val : a) {
        std::cout << (val - shortest) << " ";
    }
    std::cout << "\n";
}
